<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition template="template-without-sidebar.xhtml" xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ice="http://www.icesoft.com/icefaces/component"
                xmlns:odr="http://java.sun.com/jsf/composite/odr">

    <ui:define name="head">
        <link rel="stylesheet" type="text/css" href="resources/css/vtip.min.css" />
        <link rel="stylesheet" type="text/css" href="resources/css/jquery-ui-1.8.6.custom.css" />
        <script type="text/javascript" src="resources/js/vtip-min.js"></script>
        <script type="text/javascript" src="resources/js/searchableTable.js"></script>
        <script type="text/javascript" src="resources/js/jquery-ui-1.8.6.custom.min.js"></script>
    </ui:define>

    <ui:define name="pagetitle">
        <ice:outputText value="#{page['iteration.table.title']}" nospan="true" />
    </ui:define>

    <ui:define name="bodyBegin">
        <odr:deletePopup valid="#{iterationTableController.valid}"
                         message="#{form['table.deletion.iteration.text']}"
                         attribute="#{iterationTableController.iterationToDelete.iteration.name}"
                         removeMethod="#{iterationTableController.deleteIteration}"/>
    </ui:define>

    <ui:define name="content">
        <ice:panelGroup rendered="#{iterationTableController.valid}" >
            <odr:breadcrumb breadCrumbSource="#{iterationTableController.navigationBar}" />
            <h1><h:outputText value="#{form['table.header.iteration']}"/></h1>
            <a href="#{iterationTableController.createIterationLink}" ><img class="createConcernSymbol vtip" title="#{form['table.tooltip.create.iteration']}" src="resources/images/add.png" alt="#{common['create']}"/></a>

            <label for="searchInput" class="prefillValue" style="display: none">#{form['table.search.input']}</label>
            <input id="searchInput" onkeyup="doFilter(this, 'iterationList', false)" style="width: 200px;" class="prefill" onclick="return false;"/>
        </ice:panelGroup>

        <ice:form partialSubmit="true" rendered="#{iterationTableController.valid}">
            <table class="dataList" id="iterationList">
                <thead>
                    <tr>
                        <th style="width: 30%;">#{form['table.iteration.column.name']}</th>
                        <th style="width: 25%;">#{form['table.iteration.column.startdate']}</th>
                        <th style="width: 25%;">#{form['table.iteration.column.enddate']}</th>
                        <th style="width: 20%;">#{form['table.iteration.column.creator']}</th>
                        <th colspan="3" >#{form['table.iteration.column.actions']}</th>

                    </tr>
                </thead>
                <tbody>
                <ice:repeat value="#{iterationTableController.list}" var="item" id="iterationRepeat">
                    <tr class="parentRow group-#{item.iteration.id}">
                        <td style="border-bottom: none">
                            #{item.iteration.name}
                        </td>
                        <td>#{iterationTableController.getDate(item.iteration.startDate)}</td>
                        <td>#{iterationTableController.getDate(item.iteration.endDate)}</td>
                        <td>#{item.iteration.projectMember.person.name}</td>
                        <td>
                            <a href="#{iterationTableController.getShowLink(item)}" ><img class="vtip" title="#{form['table.tooltip.details']}" alt="#{common.read}"
                                                                                          src="resources/images/inspect.png"
                                                                                          width="14"
                                                                                          height="14"/></a></td>
                        <td><a href="#{iterationTableController.getUpdateLink(item)}" ><img class="vtip" title="#{form['table.tooltip.edit']}" alt="#{common.edit}"
                                                                                            src="resources/images/pencilSmall.png"
                                                                                            width="14"
                                                                                            height="14"/></a></td>
                        <td><ice:commandLink value=""
                                         actionListener="#{iterationTableController.showDeleteIterationConfirmation}"
                                         styleClass="columnNavigationLink">
                        <img class="vtip" title="#{form['table.tooltip.delete']}" alt="#{common.remove}"
                             src="resources/images/removeSmall.png"
                             width="14"
                             height="14"/>
                        <f:attribute value="#{item}" name="iterationitem" />
                        <f:attribute value="#{item.iteration}" name="iteration" />

                    </ice:commandLink></td>
                    </tr>
                </ice:repeat>
                </tbody>
            </table>
        </ice:form>
    </ui:define>
</ui:composition>